// 拼接HTTPUrl
function url(type, pathname) {
  return window.RPConfig[type] + pathname
}

const formCenterApi = {
  //分页查询所有数据
  getFormPage: params => {
    return $http.post(url('itShare', '/lc/form/page'), params)
  },
  //查询list数据
  findList: params => {
    return $http.post(url('itShare', '/lc/form/findList'), params)
  },
  //查询list数据
  menuFindList: params => {
    return $http.post(url('itShare', '/lc/form/menu/findList'), params)
  },
  //表单分页查询（流程模板关联表单）
  bpmpPage: params => {
    return $http.post(url('itShare', '/lc/form/bpmp/page'), params)
  },
  //复制表单
  formCopy: params => {
    return $http.post(url('itShare', '/lc/form/copy'), params)
  },
  //修改数据
  formUpdate: params => {
    return $http.post(url('itShare', '/lc/form/update'), params)
  },
  //新增数据
  formInsert: params => {
    return $http.post(url('itShare', '/lc/form/insert'), params)
  },
  //新增并提交炎黄流程
  formSubmit: params => {
    return $http.post(url('itShare', '/lc/form/submit'), params)
  },
  //删除数据
  formDelete: params => {
    return $http.post(url('itShare', '/lc/form/delete'), params)
  },
  //发布表单
  formPublish: params => {
    return $http.post(url('itShare', '/lc/form/publish'), params)
  },
  //发起填报
  formReport: params => {
    return $http.post(url('itShare', '/lc/form/report'), params)
  },
  //停止填报
  formEnd: params => {
    return $http.post(url('itShare', '/lc/form/end'), params)
  },
  //暂存数据
  formSaveOrUpdate: params => {
    return $http.post(url('itShare', '/lc/form/saveOrUpdate'), params)
  },
  //通过主键查询单条数据
  formGetById: params => {
    return $http.get(url('itShare', '/lc/form/getById'), params).then(res => res.data.data)
  },
  //根据表单ID列表查询历史周期
  formReportHistoryPeriod: params => {
    return $http.post(url('itShare', '/lcFormReportHistory/findByFormIdList'), params).then(res => res.data)
  },
  //根据表单ID列表查询历史周期
  formReportHistoryFindList: params => {
    return $http.post(url('itShare', '/lcFormReportHistory/findList'), params)
  },
  //查询list数据（任务中心）
  getNewAreaCodeList: params => {
    return $http.post(url('itShare', `/lc/form/taskCenter/findList`), params)
  },
  //查询所有数据（填报管理）
  reportFindList: params => {
    return $http.post(url('itShare', `/task/report/findList`), params)
  },
  //分页查询所有数据（审批管理）
  approvalPage: params => {
    return $http.post(url('itShare', `/task/approval/page`), params)
  },
  //获取父级菜单权限
  parentMenuPermission: params => {
    return $http.post(url('itShare', `/lc/form/parentMenuPermission`), params)
  }
}

export default formCenterApi
